﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Ext.Net;

namespace Taxes.KML
{
    public partial class LandUseChargeImport : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        [DirectMethod]
        public void DeleteFile(string fileName, string fileClientName)
        {
            try
            {
                System.IO.File.Delete(fileName);
            }
            catch (Exception ex)
            {
            }
        }

        [DirectMethod]
        public void Up(string att)
        {
            var path = System.Configuration.ConfigurationManager.AppSettings["UploadPath"].ToString();
            var fileName = Server.MapPath(path + "/" + att);
            var kml = new KMLOperate(fileName);

            var regions = kml.GetLandUseChargeRegion();
            var bll = new BLL.region_tax();

            foreach (var r in regions)
            {
                var model = new Model.region_tax()
                {
                    region_name = r.Name,
                    region_unit_price = (decimal)r.Cost,
                    region_value = r.Postion
                };
                bll.Add(model);
            }

        }
    }
}